package corej.course.collection.set.hashset;

import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

public class TestHashSetEmployee {

    @SuppressWarnings("unchecked")
    public static void main(String[] args) {
        Set s = new HashSet();
        Employee e1 = new Employee("Army", 29, 8000);
        Employee e2 = new Employee("Bomb", 36, 10000);
        Employee e3 = new Employee("Army", 29, 8000);
        Employee e4 = new Employee("Bomb", 20, 6000);

        s.add(e1);
        s.add(e2);
        s.add(e3);
        s.add(e4);

        print(s);
    }

    public static void print(Collection c) {
        Iterator it = c.iterator();
        while (it.hasNext()) {
            Object obj = it.next();
            System.out.println(obj);
        }
    }
}
